﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using MaxAlarm.Common.WebQueries;

namespace MaxAlarm.Core.WebQueries
{
    public class WebPostQuery : WebQuery
    {
        public override WebQueryType QueryType
        {
            get { return WebQueryType.POST; }
        }

        public WebPostQuery(string address, string cookieContainer, NameValueCollection data) 
            : base(address, cookieContainer, data)
        {
        }

        protected override string SendData(WebClient client, string url, NameValueCollection data)
        {
            var responseBytes = client.UploadValues(Result.Address, "POST", data);
            return Encoding.UTF8.GetString(responseBytes);
        }
    }
}
